package com.onec.service.thread.factory;

import java.util.concurrent.TimeUnit;

public class Task implements Runnable {


    @Override
    public void run() {
        try {
            TimeUnit.SECONDS.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        MyThreadFactory myThreadFactory = new MyThreadFactory("myThreadFactory");
        Task task = new Task();

        Thread thread;
        for (int i = 0; i < 10; i++) {
            thread = myThreadFactory.newThread(task);
            thread.start();
            System.out.println("---->" + myThreadFactory.getStatus());
        }
    }
}
